; Music of Nemesis (1986) (Imagine)
; Ripped by Megachur the 14/02/2009

	write "NEMESIS.BIN"

music_date_rip	equ &0e29
music_adr	equ &a0ef
first_theme	equ 0
last_theme	equ 0	; 0 -> 0

	read "music_header_v1_0.asm"

	db #00,#00,#02,#02,#00,#00,#00,#00
	db #00,#00,#00,#00,#00,#00,#00,#00
	db #00,#00,#01,#00,#1f,#03,#dd,#03
	db #01,#00,#8d,#03,#25,#02,#e5,#00
	db #f3,#01,#e8,#03,#3c,#32,#7e,#5b
	db #dd
;
.la118
.real_init_music
;
	ld hl,la1fe
	ld (la1f7),hl
	ld hl,la302
	ld (la1fb),hl
	ld a,#01
	ld (la1f6),a
	ld (la1f9),a
	ld (la1fa),a
	ld (la1fd),a
	ld hl,la19f
	ld b,#81
	ld c,#00
	ld de,la140
	call #bce0
	ret
;
.play_music
.la140
;
	push af
	push bc
	push de
	push hl
	push ix
	ld a,(la54a)
	and a
	jp nz,la1de
	ld hl,la1f6
	dec (hl)
	ld a,(hl)
	jp nz,la1de
	ld a,#03
	ld (la1f6),a
	ld a,(la1f9)
	dec a
	ld (la1f9),a
	jr nz,la1a8
	ld hl,(la1f7)
.la166
	ld e,(hl)
	inc hl
	ld d,(hl)
	ld a,e
	cp #ff
	jr z,la18e
	inc hl
	sra d
	rr e
	sra d
	rr e
	ld (la199),de
	ld a,(hl)
	inc hl
	ld (la1f7),hl
	ld (la19d),a
	ld (la1f9),a
	ld hl,la196
	call #bcaa
	jr la1a8
.la18e
	ld hl,la1fe
	ld (la1f7),hl
	jr la166
.la19d equ $ + 7
.la199 equ $ + 3
.la196
	db #01,#07,#07,#3f,#00,#00,#0f,#0c
.la19f equ $ + 1
	db #00,#00,#00,#f1,#00,#00,#81,#40
	db #a1,#00
.la1a8
	ld a,(la1fd)
	dec a
	ld (la1fd),a
	jr nz,la1de
	ld hl,(la1fb)
.la1b4
	ld e,(hl)
	inc hl
	ld d,(hl)
	ld a,e
	cp #ff
	jr z,la1e5
	inc hl
	sra d
	rr e
	sra d
	rr e
	sra d
	rr e
	ld (la1f0),de
	ld a,(hl)
	inc hl
	ld (la1fb),hl
	ld (la1f4),a
	ld (la1fd),a
	ld hl,la1ed
	call #bcaa
.la1de
	pop ix
	pop hl
	pop de
	pop bc
	pop af
	ret
.la1e5
	ld hl,la302
	ld (la1fb),hl
	jr la1b4
.la1f4 equ $ + 7
.la1f0 equ $ + 3
.la1ed
	db #02,#08,#08,#3f,#00,#00,#0c,#0c
.la1fb equ $ + 6
.la1fa equ $ + 5
.la1f9 equ $ + 4
.la1f7 equ $ + 2
.la1f6 equ $ + 1
	db #00,#01,#fa,#a2,#0c,#01,#d0,#a4
.la1fe equ $ + 1
.la1fd
	db #0c,#c3,#01,#30,#c3,#01,#24,#52
	db #01,#0c,#fd,#00,#18,#0c,#01,#30
	db #52,#01,#18,#e1,#00,#24,#7b,#01
	db #0c,#7b,#01,#48,#c3,#01,#0c,#c9
	db #00,#0c,#7b,#01,#0c,#1c,#01,#0c
	db #fd,#00,#0c,#e1,#00,#0c,#52,#01
	db #30,#92,#01,#18,#52,#01,#30,#fd
	db #00,#18,#92,#01,#0c,#7b,#01,#0c
	db #52,#01,#0c,#2d,#01,#0c,#1c,#01
	db #18,#aa,#01,#0c,#aa,#01,#18,#1c
	db #01,#18,#52,#01,#0c,#fd,#00,#18
	db #7b,#01,#0c,#fd,#00,#18,#7b,#01
	db #0c,#2d,#01,#18,#c3,#01,#30,#c3
	db #01,#24,#52,#01,#0c,#fd,#00,#18
	db #0c,#01,#30,#52,#01,#18,#e1,#00
	db #24,#7b,#01,#0c,#7b,#01,#48,#c3
	db #01,#0c,#92,#01,#0c,#7b,#01,#0c
	db #1c,#01,#0c,#fd,#00,#0c,#e1,#00
	db #0c,#c9,#00,#18,#52,#01,#0c,#52
	db #01,#24,#fd,#00,#18,#e1,#00,#18
	db #c9,#00,#30,#fd,#00,#18,#2d,#01
	db #18,#e1,#00,#a8,#1c,#01,#30,#52
	db #01,#18,#1c,#01,#48,#52,#01,#0c
	db #2d,#01,#0c,#1c,#01,#18,#2d,#01
	db #30,#c9,#00,#18,#c3,#01,#78,#92
	db #01,#0c,#7b,#01,#0c,#52,#01,#0c
	db #fd,#00,#24,#52,#01,#18,#66,#01
	db #0c,#52,#01,#0c,#2d,#01,#0c,#e1
	db #00,#24,#2d,#01,#18,#52,#01,#0c
	db #2d,#01,#0c,#1c,#01,#0c,#c9,#00
	db #24,#1c,#01,#18,#2d,#01,#0c,#1c
	db #01,#0c,#fd,#00,#0c,#be,#00,#24
	db #a9,#00,#b4,#ff,#00
.la302
	db #8f,#0a,#18,#47,#05,#0c,#47,#05
	db #0c,#47,#05,#0c,#47,#05,#0c,#8f
	db #0a,#18,#ed,#05,#18,#47,#05,#0c
	db #8f,#0a,#18,#47,#05,#18,#e1,#08
	db #18,#70,#04,#0c,#70,#04,#0c,#e1
	db #08,#0c,#70,#04,#0c,#70,#04,#0c
	db #e1,#08,#18,#70,#04,#18,#70,#04
	db #0c,#e1,#08,#18,#70,#04,#0c,#70
	db #04,#0c,#e9,#07,#18,#f4,#03,#0c
	db #f4,#03,#0c,#e9,#07,#0c,#f4,#03
	db #0c,#f4,#03,#0c,#e9,#07,#18,#f4
	db #03,#18,#f4,#03,#0c,#e9,#07,#18
	db #f4,#03,#0c,#f4,#03,#0c,#a7,#06
	db #18,#53,#03,#0c,#53,#03,#0c,#a7
	db #06,#0c,#53,#03,#0c,#53,#03,#0c
	db #ed,#05,#18,#f6,#02,#18,#f6,#02
	db #0c,#ed,#05,#18,#f6,#02,#0c,#f6
	db #02,#0c,#8f,#0a,#18,#47,#05,#0c
	db #47,#05,#0c,#8f,#0a,#18,#47,#05
	db #0c,#47,#05,#0c,#8f,#0a,#18,#47
	db #05,#0c,#47,#05,#0c,#8f,#0a,#18
	db #47,#05,#0c,#47,#05,#0c,#e1,#08
	db #18,#70,#04,#0c,#70,#04,#0c,#e1
	db #08,#18,#70,#04,#0c,#70,#04,#0c
	db #e1,#08,#18,#70,#04,#0c,#70,#04
	db #0c,#e1,#08,#18,#70,#04,#0c,#70
	db #04,#0c,#e9,#07,#18,#f4,#03,#0c
	db #f4,#03,#0c,#e9,#07,#18,#f4,#03
	db #0c,#f4,#03,#0c,#e9,#07,#18,#f4
	db #03,#0c,#f4,#03,#0c,#e9,#07,#18
	db #f4,#03,#0c,#f4,#03,#0c,#0c,#07
	db #18,#86,#03,#0c,#86,#03,#0c,#0c
	db #07,#18,#86,#03,#0c,#86,#03,#0c
	db #0c,#07,#18,#86,#03,#0c,#86,#03
	db #0c,#0c,#07,#18,#86,#03,#0c,#86
	db #03,#0c,#53,#03,#0c,#38,#02,#0c
	db #a4,#02,#0c,#38,#02,#0c,#53,#03
	db #0c,#38,#02,#0c,#a4,#02,#0c,#38
	db #02,#0c,#53,#03,#0c,#38,#02,#0c
	db #a4,#02,#0c,#38,#02,#0c,#53,#03
	db #0c,#38,#02,#0c,#a4,#02,#0c,#38
	db #02,#0c,#70,#04,#0c,#f6,#02,#0c
	db #86,#03,#0c,#f6,#02,#0c,#70,#04
	db #0c,#f6,#02,#0c,#86,#03,#0c,#f6
	db #02,#0c,#70,#04,#0c,#f6,#02,#0c
	db #86,#03,#0c,#f6,#02,#0c,#70,#04
	db #0c,#f6,#02,#0c,#86,#03,#0c,#f6
	db #02,#0c,#f4,#03,#0c,#a4,#02,#0c
	db #24,#03,#0c,#a4,#02,#0c,#f4,#03
	db #0c,#a4,#02,#0c,#24,#03,#0c,#a4
	db #02,#0c,#86,#03,#0c,#5a,#02,#0c
	db #cc,#02,#0c,#5a,#02,#0c,#86,#03
	db #0c,#5a,#02,#0c,#cc,#02,#0c,#5a
	db #02,#0c,#53,#03,#0c,#38,#02,#0c
	db #a4,#02,#0c,#38,#02,#0c,#53,#03
	db #0c,#38,#02,#0c,#a4,#02,#0c,#38
	db #02,#0c,#f6,#02,#0c,#fa,#01,#0c
	db #5a,#02,#0c,#fa,#01,#0c,#f6,#02
	db #0c,#fa,#01,#0c,#5a,#02,#0c,#fa
	db #01,#0c,#47,#05,#0c,#a4,#02,#0c
	db #a4,#02,#0c,#47,#05,#0c,#a4,#02
	db #0c,#a4,#02,#0c,#47,#05,#18,#a4
	db #02,#0c,#a4,#02,#0c,#47,#05,#18
	db #a4,#02,#0c,#a4,#02,#0c,#ff,#00
	db #01,#01,#01,#1e,#00,#00,#0d,#14
	db #00,#03,#03,#03,#2d,#00,#00,#0a
	db #14,#00,#01,#05,#05,#64,#00,#01
	db #0d,#14,#00,#05,#08
	db #57,#45,#4c,#4c,#20,#44,#4f,#4e
	db #45,#25,#02,#09,#54,#48,#45,#20
	db #50,#4c,#41,#4e,#45,#54,#20,#4e
	db #45,#4d,#45,#53,#49,#53,#25,#05
	db #0a,#49,#53,#20,#53,#41,#56,#45
.la54a equ $ + 3
	db #44,#2e,#25,#00
	db #00,#00,#00,#00,#00,#00
;
; initialized in basic !!!
;;;;;;;10 ENT -1,1,9,1:ENT -3,2,-6,1,2,6,1:ENT -5,1,-2,1:ENV 1,2,-1,2:ENV 3,2,3,1,3,2,1:ENV 5,2,-1,1:ENV 7,10,-1,5,30,0,1,10,1,10:ENT -7,2,-1,1,2,1,1,5,0,2:ENV 8,2,2,2,5,-1,2,1,-7,5:ENT -8,5,0,1,2,-1,1,2,1,1
;	
;
.init_music
;
	call define_env_ent
	jp real_init_music
	
;org #95da
;xor a
;ld (#a0f0),a
	
;
.define_env_ent	; added by Megachur
;
	ld a,-1
	ld hl,ent1
	call &bcbf
	ld a,-3
	ld hl,ent3
	call &bcbf
	ld a,-5
	ld hl,ent5
	call &bcbf
	ld a,1
	ld hl,env1
	call &bcbc
	ld a,3
	ld hl,env3
	call &bcbc
	ld a,5
	ld hl,env5
	call &bcbc
	ld a,7
	ld hl,env7
	call &bcbc
	ld a,-7
	ld hl,ent7
	call &bcbf
	ld a,8
	ld hl,env8
	call &bcbc
	ld a,-8
	ld hl,ent8
	jp &bcbf
	
env1
;ENV 1,2,-1,2
	db #01
	db 2,-1,2
env3
;ENV 3,2,3,1,3,2,1
	db #02
	db 2,3,1,3,2,1
env5
;ENV 5,2,-1,1
	db #01
	db 2,-1,1
env7
;ENV 7,10,-1,5,30,0,1,10,1,10
	db #03
	db 10,-1,5,30,0,1,10,1,10
env8
;ENV 8,2,2,2,5,-1,2,1,-7,5
	db #03
	db 2,2,2,5,-1,2,1,-7,5
	
ent1
;ENT -1,1,9,1
	db #81
	db 1,9,1
ent3
;ENT -3,2,-6,1,2,6,1
	db #82
	db 2,-6,1,2,6,1
ent5
;ENT -5,1,-2,1
	db #81
	db 1,-2,1
ent7
;ENT -7,2,-1,1,2,1,1,5,0,2
	db #83
	db 2,-1,1,2,1,1,5,0,2
ent8
;ENT -8,5,0,1,2,-1,1,2,1,1
	db #83
	db -8,5,0,1,2,-1,1,2,1,1
;
.game_name
	db "Nemesis",0
.game_year
	db "1986",0
.game_publisher
	db "Imagine",0
.music_author
	db "",0
.music_comment
	db "",0

	read "music_end_v1_0.asm"
